﻿using System.Globalization;

namespace Compass.Maui.Converters;

public class BoolToColorConverters : IValueConverter
{
    public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }

    public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

//true返回LightYellow，false返回#F0FFFF(Azure)
public class BoolToLightYellowConverters : IValueConverter
{
    public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
    {
        if (value == null || !bool.TryParse(value.ToString(), out var result)) return new SolidColorBrush(Colors.LightYellow);
        return result ? new SolidColorBrush(Colors.LightYellow) : new SolidColorBrush(Colors.Azure);
    }

    public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}
public class BoolToLightPinkConverters : IValueConverter
{
    public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
    {
        if (value == null || !bool.TryParse(value.ToString(), out var result)) return new SolidColorBrush(Colors.LightPink);
        return result ? new SolidColorBrush(Colors.LightPink) : new SolidColorBrush(Colors.Azure);
    }

    public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}